<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
             function Star(name,age) {
                 this.name=name
                 this.age=age
             
             }
            //   Star.prototype.sing=function() {
            //       console.log('唱歌')
            //   }
            //   Star.prototype.eat=function() {
            //       console.log('吃饭')
            //   }


//完全不一样 
            Star.prototype={
                constructor:Star,  //千万不要把constructor 丢了
                sing:function() {
                    console.log('唱歌')
                },
                eat:function() {
                    console.log('吃饭')
                }

            }
             let ldh=new Star('ldh',19)
             let  zxy=new Star('zxy',30)

             console.dir(Star)




// let obj={name:'王思聪'}
// obj={
//     age:20,
//     fn1:function(){}
// }
    </script>
</body>
</html>